package com.xxx.video.guide.views;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import androidx.annotation.NonNull;

import com.xxx.video.R;
import com.xxx.video.commen.views.BaseDialog;

import butterknife.BindView;
import butterknife.OnClick;

public class UserAgencyTipDialog extends BaseDialog {
    public static final int USER_AGENCY_CLICK_TYPE_FINISH_APP = 201;
    public static final int USER_AGENCY_CLICK_TYPE_START_MAIN_ACTIVITY = 202;
    public static final int USER_AGENCY_CLICK_TYPE_START_USER_AGREEMENT = 203;
    public static final int USER_AGENCY_CLICK_TYPE_start_user_privacy_policy = 204;

    //    @BindView(R.id.tv_dialog_user_agency_tip_title)
//    TextView tvDialogUserAgencyTipTitle;
//    @BindView(R.id.tv_dialog_user_agency_tip_content)
//    TextView tvDialogUserAgencyTipContent;
    @BindView(R.id.tv_dialog_user_agency_tip_agency)
    ImageView tvDialogUserAgencyTipAgency;

    @BindView(R.id.ll_dialog_user_agency_tip_button_default)
    LinearLayout llDialogUserAgencyTipButtonDefault;

    @BindView(R.id.ll_dialog_user_agency_tip_button_un_agree)
    LinearLayout llDialogUserAgencyTipButtonUnAgree;
    /**
     * listener
     */
    private OnUserAgencyDialogButtonClickListener onUserAgencyDialogButtonClickListener;

    public UserAgencyTipDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    public int getContentLayout() {
        return R.layout.dialog_user_agency_tip;
    }

    @Override
    protected void initData() {
        setCancelable(false);
    }

    @Override
    protected void initListener() {

    }

    @Override
    protected void initView(View view) {

    }

    @OnClick({R.id.tv_dialog_user_agency_tip_button_default_un_agree, R.id.tv_dialog_user_agency_tip_button_default_agree,
            R.id.tv_dialog_user_agency_tip_button_un_agree_un_agree, R.id.tv_dialog_user_agency_tip_button_un_agree_agree})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_dialog_user_agency_tip_button_default_un_agree:
                showUnAgreeContentAndButton();
                break;
            case R.id.tv_dialog_user_agency_tip_button_un_agree_un_agree:
                if (onUserAgencyDialogButtonClickListener != null) {
                    onUserAgencyDialogButtonClickListener.onUserAgencyDialogButtonClick(USER_AGENCY_CLICK_TYPE_FINISH_APP);
                }
                dismiss();
                break;
            case R.id.tv_dialog_user_agency_tip_button_default_agree:
            case R.id.tv_dialog_user_agency_tip_button_un_agree_agree:
                if (onUserAgencyDialogButtonClickListener != null) {
                    onUserAgencyDialogButtonClickListener.onUserAgencyDialogButtonClick(USER_AGENCY_CLICK_TYPE_START_MAIN_ACTIVITY);
                }
                dismiss();
                break;
            default:
                break;
        }
    }

    public void showAgreeContentAndButton() {
        llDialogUserAgencyTipButtonDefault.setVisibility(View.VISIBLE);
        llDialogUserAgencyTipButtonUnAgree.setVisibility(View.GONE);
//        tvDialogUserAgencyTipContent.setText(StringUtils.getInstance().getString(R.string.tv_dialog_user_agency_tip_content_default));
    }

    public void showUnAgreeContentAndButton() {
        llDialogUserAgencyTipButtonDefault.setVisibility(View.GONE);
        llDialogUserAgencyTipButtonUnAgree.setVisibility(View.VISIBLE);
        tvDialogUserAgencyTipAgency.setImageResource(R.drawable.icon_dialog_user_agency_tip_agency_unagree);
//        tvDialogUserAgencyTipContent.setText(StringUtils.getInstance().getString(R.string.tv_dialog_user_agency_tip_content_un_agree));
    }

    public interface OnUserAgencyDialogButtonClickListener {
        /**
         * item click
         *
         * @param type type
         */
        void onUserAgencyDialogButtonClick(int type);
    }

    public void setOnUserAgencyDialogButtonClickListener(OnUserAgencyDialogButtonClickListener onUserAgencyDialogButtonClickListener) {
        this.onUserAgencyDialogButtonClickListener = onUserAgencyDialogButtonClickListener;
    }
}
